import { Component, OnInit } from '@angular/core';
import { DataService } from '../../services/data.service';
@Component({
  selector: 'app-home',
  templateUrl: './home.component.html',
  styleUrls: ['./home.component.css']
})
export class HomeComponent implements OnInit {
  // users:string[];
  // data:any[] = [];

  users:any[]=[];
  constructor(public dataService:DataService) {
    // console.log(this.dataService.getUsers());
    // this.users=this.dataService.getUsers();

    //Observable
    // this.dataService.getUsers().subscribe(data=>{
    //   console.log(data);
    //   this.data.push(data);
    // })

    //GET
    this.dataService.getUsers().subscribe(users=>{
      console.log(users);
    });
   }

  ngOnInit() {
  }

}
